package com.fsquare.service.paypal;

import java.util.Map;

import javax.servlet.http.HttpServletRequest;

import org.broadleafcommerce.core.payment.service.PaymentContext;

import com.fsquare.domain.paypal.PayPalPayment;
import com.paypal.api.payments.Authorization;
import com.paypal.api.payments.Payment;
import com.paypal.api.payments.Sale;
import com.paypal.core.rest.PayPalRESTException;

public interface PayPalService {
		
	public static final String RESULT_ACCESS_TOKEN = "ACCESS_TOKEN";
	public static final String RESULT_PAYMENT = "PAYMENT";
	public static final String RESULT_ADDITIONAL_FIELDS = "ADDITIONAL_FIELDS";
	public static final String RESULT_CREDIT_CARD_INFO = "CREDIT_CARD_INFO";
	
	
	public static final String PAYMENT_STATE = "PAYMENT_STATE";
	public static final String PAYMENT_STATE_CREATED = "created";
	public static final String PAYMENT_STATE_APPROVED = "approved";
	public static final String PAYMENT_STATE_FAILED = "failed";
	public static final String PAYMENT_STATE_PENDING = "pending";
	public static final String PAYMENT_STATE_CANCELED = "canceled";
	public static final String PAYMENT_STATE_EXPIRED = "expired";
	public static final String PAYPAL_INTENT_SALE= "sale";
    public static final String PAYPAL_INTENT_AUTHORIZE= "authorize";
    public static final String PAYPAL_PAYMENT_METHOD_CREDIT_CARD= "credit_card";
    public static final String PAYPAL_PAYMENT_METHOD_PAY_PAL= "paypal";
	
	Map<String, Object> creditCardPayment(PaymentContext paymentContext);
    
    String payPalPayment(HttpServletRequest request);
    
    PayPalPayment payPalPaymentReturn(HttpServletRequest request);
    
    PayPalPayment payPalPaymentCancel(HttpServletRequest request);
        
    String getAccessToken() throws PayPalRESTException;
    
    String validateCardType(String ccNumber);
    
    String validateCardType(PaymentContext paymentContext);
	
    String getPaymentHystory(String quantity);
    
    Sale getSale(String saleId);
    
    String saleRefund(Sale sale);

	Authorization getAuthorization(PaymentContext paymentContext)throws PayPalRESTException;

//	String payPalPayment(BillingInfoForm billingForm);
    
}
